[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
_graphgetmem() Allocate Graphics Memory
#include <graphics.h>
void far *far _graphgetmem(size);
unsigned size;
_graphgetmem() allocates memory for internal buffers, graphics
drivers and character sets. You can control graphics memory
allocation by defining your own version of _graphgetmem(). You must
declare your _graphgetmem() function exactly the same as shown above.
Returns: Nothing.
-------------------------------- Example ---------------------------------
The following statements define a new _graphgetmem() function which
initgraph() uses to allocate memory.
#include <graphics.h>
#include <alloc.h>
#include <stdio.h>
int far *gblock;
main()
{
int gdriver = DETECT;
int gmode;
initgraph(&gdriver,&gmode,"");
.
.
/* graphics operations */
.
.
closegraph();
}
void far *far _graphgetmem(size)
unsigned size;
{
if ((gblock = farmalloc(size)) != NULL)
printf("_graphgetmem allocated %u memory\n",size);
else
printf("unable to allocate memory\n");
getch();
return(gblock);
}
void far _graphfreemem(ptr,size)
void far *ptr;
unsigned size;
{
printf("_graphfreemem called, amount freed = %d\n",size);
getch();
farfree(ptr);
}
See Also:
_graphfreemem()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson